<%@ Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="Site.aspx.cs" Inherits="Site" Title="Untitled Page" %>

<asp:Content ID="Content2" runat="Server" ContentPlaceHolderID="phActions">
    <asp:LinkButton ID="btnEdit" Text="Edit"  runat="server" OnClick="btnEdit_Click" CausesValidation="False" />
    <asp:LinkButton ID="btnSave" Text="Save" CausesValidation="true" runat="server" OnClick="btnSave_Click" Visible="False" />
    <asp:LinkButton ID="btnCancel" Text="Cancel" runat="server" OnClick="btnCancel_Click" Visible="False" CausesValidation="False" />
    <asp:LinkButton ID="btnAddMapping" Text="Add Mapping" runat="server" OnClick="btnAddMapping_Click" />
    <asp:LinkButton ID="btnSaveMapping" Text="Save" ValidationGroup="SaveMapping" runat="server" OnClick="btnSaveMapping_Click" />
    <asp:LinkButton ID="btnCancelMapping" Text="Cancel" runat="server" OnClick="btnCancelMapping_Click" CausesValidation="False" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="phMain" Runat="Server">
    <fieldset>
        <legend>Site Details</legend>
        <asp:DetailsView ID="dvSite" runat="server" DataSourceID="dsSite" AutoGenerateEditButton="False" AutoGenerateRows="False" DataKeyNames="Id,ConcurencyId" >
            <Fields>
                <acms:TextBoxField DataField="Name" HeaderText="Name" Required="True" Width="250" MaxLength="20"/>
                <acms:TextBoxField DataField="Root" HeaderText="Root" Required="True" Width="500" MaxLength="255"/>
            </Fields>
        </asp:DetailsView>
    </fieldset>
    <fieldset>
        <legend>Mappings</legend>
        <asp:Panel ID="phSiteMappingsGrid" runat="server">
            <asp:GridView ID="gvSiteMappings" DataSourceID="dsSiteMappings" DataKeyNames="Id,ConcurencyId" EmptyDataText="There are no Site Mappings currently set up" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvSiteMappings_SelectedIndexChanged" >
                <Columns>
                    <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" />
                    <asp:BoundField DataField="MappingName" HeaderText="Mapping" SortExpression="MappingName" />
                    <acms:CommandField ButtonType="Link" Text="Edit" CommandName="Select" CausesValidation="False" EditVisible="True" HeaderText="" ReadOnlyVisible="True" SelectedVisible="True" />
                    <acms:CommandField ButtonType="Link" Text="Delete" CommandName="Delete" ConfirmMessage="Are you sure you want to delete this mapping?" CausesValidation="False" EditVisible="True" HeaderText="" ReadOnlyVisible="True" SelectedVisible="True" />
                </Columns>
            </asp:GridView>
        </asp:Panel>
        <asp:Panel ID="phSiteMappingsDetails" runat="server">
            <asp:DetailsView ID="dvSiteMappings" runat="server" AutoGenerateRows="False" DataSourceID="dsSiteMappings" DataKeyNames="Id,ConcurencyId">
                <Fields>
                    <acms:TextBoxField DataField="MappingName" HeaderText="Mapping" Required="True" Width="250px" MaxLength="255" RequiredDisplay="Dynamic" />
                </Fields>
            </asp:DetailsView>
        </asp:Panel>
        
    </fieldset>
    <acms:SiteDataSource ID="dsSite" runat="server" OnSelectData="dsSite_SelectData" OnUpdatedData="dsSite_UpdatedData"/>
    <acms:SiteMappingDataSource ID="dsSiteMappings" runat="server" OnSelectData="dsSiteMappings_SelectData" OnUpdatingData="dsSiteMappings_UpdatingData" />
</asp:Content>

